from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from api.file_api import router as file_router
from api.user_api import router as user_router
from middleware.exception_handler import exception_handler

app = FastAPI(
    title="文件处理系统",
    description="文件上传、处理和管理系统的API文档",
    version="1.0.0"
)

# 注册全局异常处理器
app.add_exception_handler(Exception, exception_handler)

# 注册路由
app.include_router(user_router, prefix="/api/user", tags=["用户管理"])
app.include_router(file_router, prefix="/api/file", tags=["文件管理"])

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000) 